package com.ruoyi.web.controller.durian.alipay;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.durian.service.TPayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/alipay")
public class AliPayController {

    @Resource
    private TPayService tPayService;

    /**
     * 支付宝支付
     * @param orderNo
     * @return
     * @throws java.io.IOException
     */
    @GetMapping("/submitAlipay/{orderNo}")
    public AjaxResult submitAlipay(@PathVariable("orderNo") String orderNo){
        return AjaxResult.success(tPayService.submitAlipay(orderNo));
    }

    /**
     * 支付宝回调
     * @param paramsMap
     * @return
     */
    @PostMapping("/callback/notify")
    public AjaxResult callback(@RequestParam Map<String, String> paramsMap){
        return tPayService.callback(paramsMap);
    }
}
